from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from meiduo_admin.my_paginate import MyPageNumberPagination
from django.contrib.auth.models import Group, Permission
from meiduo_admin.serializer import permission_group_serializer


class PermissionGroupView(ModelViewSet):
    pagination_class = MyPageNumberPagination
    serializer_class = permission_group_serializer.PermissionGroupSerializer
    queryset = Group.objects.order_by('id')


class PermissionSimpleView(ListAPIView):
    queryset = Permission.objects.all()
    serializer_class = permission_group_serializer.PermissionSimpleSerializer